//
//  BBLeaveCell.m
//  BearSiX
//
//  Created by BearBaby on 16/3/28.
//  Copyright © 2016年 Tom. All rights reserved.
//

#import "BBLeaveCell.h"

@implementation BBLeaveCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //输入框
        self.textView = [[UITextView alloc]initWithFrame:CGRectMake(15, 10, WINSIZEWIDTH - 30, 50)];
        self.textView.userInteractionEnabled = YES;
        self.textView.scrollEnabled = YES;
        self.textView.delegate = self;
        self.textView.font = [UIFont systemFontOfSize:WINSIZEWIDTH/25];
        [self addSubview:self.textView];
        //输入申请原因
        self.textViewLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 10, WINSIZEWIDTH - 30, 20)];
        self.textViewLabel.text = @"请输入申请原因";
        self.textViewLabel.textColor = [UIColor colorWithHexString:@"bebfc0"];
        self.textViewLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/25];
        self.textViewLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:self.textViewLabel];
        
        
        
        
        //图片数组
        //添加图片按钮
        self.addImage = [[UIButton alloc]initWithFrame:CGRectMake(15, CGRectGetMaxY(self.textView.frame) + 15, WINSIZEWIDTH/7, WINSIZEWIDTH/7)];
        [self.addImage setImage:[UIImage imageNamed:@"addImage"] forState:UIControlStateNormal];
        [self addSubview:self.addImage];
        
        //添加图片
        self.addLabel = [[UILabel alloc]init];
        self.addLabel.text = @"(添加图片)";
        self.addLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/25];
        self.addLabel.textColor = [UIColor colorWithHexString:@"bebfc0"];
        CGSize size = [self.addLabel.text sizeWithFont:self.addLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByCharWrapping];
        self.addLabel.frame = CGRectMake(CGRectGetMaxX(self.addImage.frame)+10, CGRectGetMaxY(self.addImage.frame)-size.height, size.width, size.height);
        [self addSubview:self.addLabel];
        
        _finalH = CGRectGetMaxY(self.addLabel.frame) + 10;
    }
    return self;
}
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    [self.textViewLabel removeFromSuperview];
    return YES;
}

@end
